/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ch04_01;

/**
 *
 * @author osa
 */
public class Card {
    private String suit;
    private String rank;

    private static String[] suits = {"Spade", "Heart", "Club", "Diamond"};
    private static String[] ranks = {"Ace", "2", "3", "4", "5", "6", "7",
                                     "8", "9", "10", "Jack", "Queen", "King"};

    public static String[] getSuits() {
        return suits;
    }

    public static String[] getRanks() {
        return ranks;
    }

    Card(String suit, String rank) {
        this.suit = "";
        for (String s : suits) {
            if (s.equals(suit)) {
                this.suit = suit;
                break;
            }
        }
        if ("".equals(this.suit))
            System.err.println("Invalid suit!!");

        this.rank = "";
        for (String r : ranks) {
            if (r.equals(rank)) {
                this.rank = rank;
                break;
            }
        }
        if ("".equals(this.rank))
            System.err.println("Invalid rank!!");
    }

    public String getSuit() {
        return this.suit;
    }

    public String getRank() {
        return this.rank;
    }

}
